<?php

class Manager_Form_Category extends Zend_Form
{
    
    public function init()
    {  
        $buffer =  array();
        $buffer[0] = 'none';
        $dataCategory = new Manager_Model_Category();
        foreach($dataCategory->getData() as $each):
            $buffer[$each['category_code']] = $each['category_name']; 
        endforeach;    
        
        
        
        $categoryName = new Zend_Form_Element_Text('Category_Name');
        $categoryName->setLabel('Category Name')->setRequired(true)->addValidator('notEmpty');
        
        $categoryInfo= new Zend_Form_Element_Textarea('Category_Info');
        $categoryInfo->setAttrib('rows', 6);
        $categoryInfo->setAttrib('cols', 40);
        $categoryInfo->setLabel('Category Info')->setRequired(true);
        
        $categoryParent = new Zend_Form_Element_Select('Category_Parent');
        $categoryParent->setMultiOptions($buffer);
        $categoryParent->setLabel('Parent');
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('save');
        $this->addElements(array($categoryName,$categoryInfo,$categoryParent,$submit));
    }


}

